#pragma once
#include "scanner/object.h"

namespace Pdf
{
	class Serializer : public VisitorT<DefaultNone>
	{
	public:
		Serializer(std::ostream &output);

	private:
		virtual void     __fastcall visited(Integer *obj);
		virtual void     __fastcall visited(Real *obj);
		virtual void     __fastcall visited(Keyword *obj);
		virtual void     __fastcall visited(Comment *obj);
		virtual void     __fastcall visited(Name *obj);
		virtual void     __fastcall visited(String *obj);
		virtual void     __fastcall visited(Array *obj);
        virtual void     __fastcall visited(Names *obj);
		virtual void     __fastcall visited(Dictionary *obj);
		virtual void     __fastcall visited(Reference *obj);

		std::ostream&               output;
        bool                        delimiter;
	};

	inline std::ostream& operator << (std::ostream &output, Object& obj)
	{
		obj.apply( &Serializer( output ) );
		return output;
	}
}